<?php echo $this->render('front_header.phtml'); 

if(!$this->level) {
?> 
<br>
<br>
<br>
Please select level &nbsp; 
<a href="/test/1">Low</a> &nbsp; <a href="/test/2">Middle</a> &nbsp; <a href="/test/3">High</a>
<br>
<br>
<br>
<?php 
} elseif($this->result) {
    echo $this->result;
} else {
?>
<link type="text/css" rel="stylesheet" href="/public/js_calendar/dhtmlgoodies_calendar.css" media="screen"></LINK>
<script type="text/javascript" src="/public/js_calendar/dhtmlgoodies_calendar.js"></script>
<form action="/test" method="post">
  <input type="hidden" name="level" value="<?php echo $this->level;?>">
  <?php if(!empty($this->message)) {?>
    <b style="color:red;"><?php echo $this->message;?></b>
    <?php } 
    echo '<b>Test Level '.$this->level.'</b><br><br>';
    foreach($this->list as $i => $test) {
        echo ($i+1).'. '.$test->question.'<br><br>';
        $answers = explode(';',$test->answers);
        foreach($answers as $ans){
            echo '<input type="radio" name="questions['.$test->id.']" value="'.$ans.'" style="width:15px;" '.(@$this->answers[$test->id]==$ans?' checked="checked" ':'').'> '.$ans.' &nbsp; ';
        }
        echo '<br><br><br>';
    }
    
    ?>
    <table border="0">
    <tr><td><?php if($_SESSION['lang']=='en') echo 'First Name'; else echo 'Имя';?></td><td><input type="text" size="54" id="first_name" name="first_name" value="<?php echo $this->escape(trim($this->first_name));?>"></td></tr>
    <tr><td><?php if($_SESSION['lang']=='en') echo 'Last name'; else echo 'Фамилия';?></td><td><input type="text" size="54" id="last_name" name="last_name" value="<?php echo $this->escape(trim($this->last_name));?>"></td></tr>
    <tr><td>E-mail</label></td><td><input type="text" size="54" id="email" name="email" value="<?php echo $this->escape(trim($this->email));?>"></td></tr>
    <tr><td><?php if($_SESSION['lang']=='en') echo 'Phone'; else echo 'Телефон';?></label></td><td><input type="text" size="54" id="phone" name="phone" value="<?php echo $this->escape(trim($this->phone));?>"></td></tr>
    <tr><td><?php if($_SESSION['lang']=='en') echo 'Bithday'; else echo 'День рождения';?></label></td><td>
        <table border="0" cellpadding="0" cellspacing="0"><tr>
        <td><input type="text" size="10" id="birthday" name="birthday" value="<?php echo $this->escape(trim($this->birthday));?>"></td>
        <td><img id="birthday_trigger" src="/public/images/cal.gif" style="padding:6px;" onclick="displayCalendar(document.getElementById('birthday'),'yyyy-mm-dd',this);"></td>
        </tr></table>
    </td></tr>
    <tr><td><?php if($_SESSION['lang']=='en') echo 'Address'; else echo 'Адрес';?></label></td><td><input type="text" size="54" id="address" name="address" value="<?php echo $this->escape(trim($this->address));?>"></td></tr>
    <tr><td>Skype</label></td><td><input type="text" size="54" id="contacts" name="contacts" value="<?php echo $this->escape(trim($this->contacts));?>"></td></tr>
    </table>
    
    <div class="button1">
    <a href="javascript:document.forms[0].submit();" ><img src="/public/images/button3.png" class="button" alt="button2.png, 3,5kB" height="24" width="187"></a>
    </div>
    
  </fieldset>         
</form>
<?php } ?>
<?php echo $this->render('front_footer.phtml'); ?>